/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 * @description 备忘录
 */

var twoSum = function (nums, target) {
    let map = new Map()
    let len = nums.length
    for (let i = 0; i < len; i++) {
        if (!map.has(target - nums[i])) {
            map.set(nums[i], nums[i])
        } else {
            return [map.get(target - nums[i]), nums[i]]
        }
    }
};